from flask import Flask,render_template,request
app=Flask(__name__)
@app.route("/register",methods=["GET"])
def register():
    return render_template("register.html")

@app.route("/do/reg",methods=["GET"])
def do_reg():
    # print(request.args)
    user = request.args.get("用户名")
    pwd = request.args.get("密码")
    gender = request.args.get("gender")
    hobby = request.args.getlist("hobby")
    county = request.args.get("county")
    certificate = request.args.getlist("certificate")
    introduction = request.args.get("self-introduction")
    print(user, pwd, gender, hobby, county, certificate, introduction)
    return "注册成功"
@app.route("/post/reg",methods=["POST"])
def post_reg():
    # print(request.form)
    user=request.form.get("用户名")
    pwd=request.form.get("密码")
    gender = request.form.get("gender")
    hobby=request.form.getlist("hobby")
    county=request.form.get("county")
    certificate=request.form.getlist("certificate")
    introduction=request.form.get("self-introduction")
    print(user,pwd,gender,hobby,county,certificate,introduction)
    return "恭喜发财"
@app.route("/zuhe",methods=["GET","POST"])
def zuhe():
    if request.method=="GET":
        return render_template("zuhe.html")
    else:
        user = request.form.get("用户名")
        pwd = request.form.get("密码")
        gender = request.form.get("gender")
        hobby = request.form.getlist("hobby")
        county = request.form.get("county")
        certificate = request.form.getlist("certificate")
        introduction = request.form.get("self-introduction")
        print(user, pwd, gender, hobby, county, certificate, introduction)
        return "福如东海，寿比南山！"
@app.route("/login",methods=["GET","POST"])
def login():
        if request.method=="GET":
            return render_template("login.html")
        else:
            print(request.form)
            return "登录成功"
if __name__ == '__main__':
    app.run()